<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018-08-15
 * Time: 15:15
 */

namespace App\Http\Controllers\Validator;


use Validator;

class WorkVali
{
   /**
    * 添加工作总结验证必填字段的方法
    */
    public static function work($params)
    {
        $validator = Validator::make($params, [
            'ws_title'                   => 'required',
            'ws_job_content'             => 'required',//工作总结
        ]);
        if ($validator->fails()) {
            return false;
        }
        return true;
    }

    /**修改工作总结的内容
     * @param $params
     * @return bool
     */
    public static function edit($params)
    {
        $validator = Validator::make($params, [
            'ws_id'             => 'required',
            'ws_job_content'             => 'required',//工作总结
        ]);
        if ($validator->fails()) {
            return false;
        }
        return true;
    }

    /**删除工作总结
     * @param $params
     * @return bool
     */
    public static function del($params)
    {
        $validator = Validator::make($params, [
            'ws_id'             => 'required',
        ]);
        if ($validator->fails()) {
            return false;
        }
        return true;
    }

    /**点评
     * @param $params
     * @return bool
     */
    public static function review($params)
    {
        $validator = Validator::make($params, [
            'ws_id'             => 'required',
            'ws_comment'        => 'required',//点评内容
        ]);
        if ($validator->fails()) {
            return false;
        }
        return true;
    }

    /**
     * 列表条件的验证
     */
    public static function listWork($params)
    {
        $validator = Validator::make($params, [
            'peopleType'        => 'required',
            'dateType'          => 'required',
            'ws_did'            => 'required',
            'ws_uid'            => 'required',
            'start_time'        => 'required',
            'end_time'          => 'required',
        ]);
        if ($validator->fails()) {
            return false;
        }
        return true;
    }

    /**工作总结回收站的验证条件
     * @param $params
     * @return bool
     */
    public static function recycleBin($params)
    {
        $validator = Validator::make($params, [
            'start_time'        => 'required',
            'end_time'          => 'required',
        ]);
        if ($validator->fails()) {
            return false;
        }
        return true;
    }

}